#ifndef   __X264_Code__
#define   __X264_Code__
#include <stdint.h>    
#include <x264.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//编码器信息相关结构体
typedef struct encode{
	x264_param_t param; //相关配置信息
	x264_nal_t *nal;    //NAL单元   编码之后存储的NAL单元
	x264_picture_t picture;	  //H264图像，主要是用来存YUV分量的
	x264_t *handle;     //编码器指针
}Encode; 

//SPS和PPS相关结构体    ----单独的存放SPS和PPS
typedef struct sps_pps{
	uint8_t * sps;   //sps内容
	uint8_t * pps;   //pps内容
	uint32_t sps_len;   //sps长度
	uint32_t pps_len;   //pps长度
}sps_pps;

typedef   struct  sps_pps_buf{
	char   *buf;   //sps和pps的NAL单元   0x00 00 00 01+SPS+0x00  00  00  01+PPS 
	unsigned  int  length;   //sps+pps的大小
	
}sps_pps_buf;


//编码器初始化
int   X264_Iinit(Encode *  en,sps_pps *  sp);

//转码
int  X264_Encode(Encode *  en,unsigned  char  *  cam_buf,int  *  nal_num);

//资源释放
int X264_Release(Encode *  en,sps_pps *  sp);

//pps 和SPS打包
void   X264_GetSPS_PPS_Buff(sps_pps  *  sp,  sps_pps_buf *  buff);






#endif